#include <string.h>

int main(int argc, char *argv[]) {
    // strlen(const char *)
    // 1. must terminated in \0 
    char src1[6] = "hello";
    printf("strlen: %d\n", strlen(src1));

    // strcpy(char *dst, const char *src)
    // 1. dst must big enough to contain src
    // 2. src must terminated in \0, and would be copied to dst
    char src2[5] = "wxyz";
    char dst2[10] = "abc";
    strcpy(dst2, src2);
    printf("strcpy: %s\n", dst2); // wxyz

    // strcat(char *dst, const char *src)
    // same as strcpy, add src to dst
    char src3[5] = "wxyz";
    char dst3[10] = "abc";
    strcat(dst3, src3);
    printf("strcat: %s\n", dst3); // abcwxyz

    // strncpy(char *dst, const char *src, size_t count)
    char src4[5] = "wxyz";
    char dst4[10] = "abc";
    strncpy(dst4, src4, 2);
    printf("strncpy: %s\n", dst4); // wxc

    // strncat(char *dst, const char *src, size_t count)
	char src5[5] = "wxyz";
    char dst5[10] = "abc";
    strncat(dst5, src5, 2);
    printf("strcat: %s\n", dst5); // abcwx

    // memcpy(void *dst, void *src, size_t count)
    // do not deal with conflict, faster
	char src6[5] = "wxyz";
    char *dst6;
    memcpy(dst6, src6, 2);
	printf("memcpy: %s\n", dst6); // wxyz

    // memmove(void *dst, void *src, size_t count)
    // deal with conflict, use buffer, slower

    // memset(void *src, int c, size_t count)

    return 0;
}